//
//  ViewController.m
//  Data_recursive
//
//  Created by Maculish Ting on 15/4/23.
//  Copyright (c) 2015年 LYD. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    int a=[self getNumFrom:3];
    NSLog(@"%d",a);
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark- 递归求斐波纳西数列
//  限定参数类型：无符号整形
//  第三项以后，多调用好几次
-(int)getNumFrom:(unsigned int)location
{
    if (location==1||location==2) {
        return 1;
    }else
        return [self getNumFrom:location-1]+[self getNumFrom:location-2];
}

@end
